package com.gwsdk.paysdk.holder;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.gwsdk.paysdk.entity.GamePayRecordEntity;
import com.gwsdk.paysdk.utils.AppUtils;
import com.gwsdk.paysdk.utils.GWInflaterUtils;


public class GWGamePayListHolder extends BaseHolder<GamePayRecordEntity.ListsBean> {

    private final Context context;
    private LayoutInflater mInflater;
    private TextView tvName;
    private TextView tvTime;
    private TextView tvMoney;
    private TextView tvPayType;

    public GWGamePayListHolder(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    protected void refreshView(GamePayRecordEntity.ListsBean s, int position, Activity activity) {
        tvName.setText(s.getGame_name());
        tvMoney.setText("-"+s.getPay_amount());
        tvPayType.setText(s.getPay_way());
        tvTime.setText(AppUtils.MonthDay(s.getPay_time()+"","yyyy/MM/dd HH:mm:ss"));

    }

    @Override
    protected View initView(Context context) {
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View inflate = mInflater.inflate(GWInflaterUtils.getLayout(context,"gw_item_game_pay"), null);
        tvName = inflate.findViewById(GWInflaterUtils.getControl(context,"tv_name"));
        tvTime = inflate.findViewById(GWInflaterUtils.getControl(context,"tv_time"));
        tvMoney = inflate.findViewById(GWInflaterUtils.getControl(context,"tv_money"));
        tvPayType = inflate.findViewById(GWInflaterUtils.getControl(context,"tv_pay_type"));
        inflate.setTag(this);
        return inflate;
    }

}
